Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attribute ordering compilation error #11606

Closed

Conversation

mumbleskates
Copy link
Contributor

The [[nodiscard]] attribute seemingly needs to come before __attribute__((deprecated(foo))).

Error:

In file included from external/com_google_protobuf/src/google/protobuf/compiler/subprocess.cc:52:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_nowkt/google/protobuf/message.h:126:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_nowkt/google/protobuf/generated_message_reflection.h:50:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_nowkt/google/protobuf/unknown_field_set.h:52:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/parse_context.h:47:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/implicit_weak_message.h:39:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/repeated_field.h:61:
bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/repeated_ptr_field.h:1164:3: error: 'nodiscard' attribute cannot be applied to types
  PROTOBUF_NODISCARD Element* ReleaseCleared();
  ^
bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/port_def/google/protobuf/port_def.inc:558:30: note: expanded from macro 'PROTOBUF_NODISCARD'
#define PROTOBUF_NODISCARD [[nodiscard]]
                             ^
1 error generated.

@mumbleskates mumbleskates requested a review from a team as a code owner January 19, 2023 23:38
@mumbleskates mumbleskates requested review from mcy and removed request for a team January 19, 2023 23:38
mumbleskates referenced this pull request Jan 20, 2023
This will be removed in a future release.

PiperOrigin-RevId: 503218340
@mkruskal-google
Copy link
Member

#11609 should cover this, and will get in slightly faster since it's going in the opposite direction. Thanks for the fix tho!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants